resource "alicloud_vpc" "this" {
  vpc_name   = var.vpc_name
  cidr_block = var.vpc_cidr
}

resource "alicloud_vswitch" "this" {
  count = length(var.vswitch_cidrs)

  cidr_block = element(var.vswitch_cidrs, count.index)
  zone_id = element(var.zone_ids, count.index)

  vswitch_name = format("%s_%s", var.vswitch_name, count.index)

  vpc_id     = alicloud_vpc.this.id
  depends_on = [alicloud_vpc.this]
}